Windows: Use virtual terminal processing if available #177
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to: fusesource/jansi#63. Windows 10 adds native support for ANSI escape codes, although they're only enabled when
ENABLE_VIRTUAL_TERMINAL_PROCESSING
is set for the output handle.I was curious how well it's working in Windows 10 and attempted to use it for JLine. After enabling the flag and disabling the
AnsiWriter
, I wasn't able to find any functional difference betweenAnsiWriter
and the native functionality so it appears to work pretty well. (I tested using Gogo and a custom simpleLineReader
command line app)The implementation attempts to set
ENABLE_VIRTUAL_TERMINAL_PROCESSING
but will still fall back to theAnsiWriter
for older Windows versions.Not sure if we should merge this right away. I wasn't able to find any problems but it wouldn't hurt to do more testing. Considering everything is working fine with the current code, it isn't top-priority either.